package com.xianyu.us.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xianyu.us.pojo.entity.UsPayOrderParam;
import com.xianyu.us.service.UsPayService;

/**
 * 支付页面相关入口
 * @author wangshili
 *
 */
@RequestMapping("/pay/")
@Controller
public class UsPayController {
	
	@Autowired
	private UsPayService usPayService;
	
	/**
	 * 点击付款请求
	 * @param params 付款的相关参数
	 * @return
	 */
	@RequestMapping("request")
	@ResponseBody
	public String pay(UsPayOrderParam params) {		
		return usPayService.usPay(params);//将结果返回，让支付宝来处理
	}
	
	
	@RequestMapping("pay")
	public String payHtml(UsPayOrderParam param,Model model) {
		model.addAttribute("param", model);
		System.out.println(param);
		return "pages/pay";//跳转到支付订单页面
	}
}
